#!/bin/sh

# service vairables define below
#DAY=$1
DAY=`date +%Y%m%d`
DIR=$(dirname $0)
JAVA_DIR=/home/no-delete/jdk1.6.0_33
JAVA_OPTS="-Xms128m -Xmx256m -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
SPIDER_NAME=sinaStockInfoSpider
SPIDER_OPS=""
RUNNER_CLASS=com.easy.stock.spider.SpiderDriver
RUNNER_JAR=crawler-0.0.1-SNAPSHOT-jar-with-dependencies.jar

# functions
function setenv()
{
    export JAVA_HOME=$JAVA_DIR
    export JRE_HOME=$JAVA_DIR/jre
    export PATH=$JAVA_HOME/bin:$PATH
    ulimit -n 150000
}

setenv
nohup java $JAVA_OPTS -cp $DIR:$DIR/$RUNNER_JAR $RUNNER_CLASS -spiderName $SPIDER_NAME $SPIDER_OPS > $DIR/../logs/$SPIDER_NAME.log.$DAY &
echo "sucess"

